﻿using System.Collections.Generic;

namespace FDSimpleModelGenerator.Models.ClassTemplates
{
    /// <summary>
    /// 创建表模型
    /// </summary>
    public class GenCreateTableModel : CommonSettingModel
    {
        /// <summary>
        /// 表描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 执行建表Sql
        /// </summary>
        public bool ExecuteSql { get; set; }

        /// <summary>
        /// 存在表则删除
        /// </summary>
        public bool DeleteExists { get; set; }

        /// <summary>
        /// 表列
        /// </summary>
        public List<CreateTableColumn> Columns { get; set; }

        /// <summary>
        /// 索引列
        /// </summary>
        public List<CreateTableIndex> Indexes { get; set; }
    }

    /// <summary>
    /// 生成表列
    /// </summary>
    public class CreateTableColumn
    {
        public string ColumnName { get; set; }
        public bool PrimaryKey { get; set; }
        public string DataType { get; set; }
        public string Length { get; set; }
        public bool AllowNulls { get; set; }
        public string DefaultValue { get; set; }
        public string IncrementValue { get; set; }
        public bool Unsigned { get; set; }
        public string Remark { get; set; }
    }

    /// <summary>
    /// 生成索引项
    /// 每个索引最多6列
    /// </summary>
    public class CreateTableIndex
    {
        public string IndexName1 { get; set; }
        public string IndexName2 { get; set; }
        public string IndexName3 { get; set; }
        public string IndexName4 { get; set; }
        public string IndexName5 { get; set; }
        public bool UniqueIndex { get; set; }
    }
}
